<?php
if(!defined('BZ_XTBLOG') || !defined('BZ_WJSCUZ')) {
	exit('Access Denied');
}
$fid =verify_id($_GET['fid']);
$act =$_GET['act'];
$forum=$db->get_one('forum'," `id` ='$fid' AND `sz_sc` ='0'",'');
$forumlt=$db->get_one('forum_class'," `id` ='$forum[cid]'",'');
$wzxx_title =$forum[name].'-帖子管理-'.$wzxx_title.'';
$wzxx_gj    =$wzcontent.'-帖子管理-'.$wzxx_gj.'';
$wzxx_ms    =$wzcontent.'-帖子管理-'.$wzxx_ms.'';
     $ltid  =$forumlt[id];
     $ltname=$forumlt[name];
     $forum_id=$forum[id];
     $forum_name=$forum[name];
  if(!$user_uid){
		$pdid='1';
	}else if(!$forum or !$forumlt){
		$pdid='2';
	}else if($forum[uid] != $user_uid ){
		$pdid='3';
	}else if($db->get_one('forum'," `id` ='$fid' AND `type_suo` ='1'",'')){
    $pdid='4';
	}else if($act == 'fj'){
      $tzfl=$db->query('forum_data'," `fid` ='$forum[id]' ORDER BY `id` ",'');
      while($tz=mysql_fetch_array($tzfl)){//附件
            if($tz[fwsz] == '1'){$fwsz1='CHECKED';}elseif($tz[fwsz] == '2'){$fwsz2='CHECKED';}elseif($tz[fwsz] == '0'){$fwsz3='CHECKED';}
            $fjlb[]= array("id"=>"$tz[id]","name"=>"$tz[name]","namej"=>"$tz[name]","fwsz"=>"$tz[fwsz]","fwsz1"=>"$fwsz1","fwsz2"=>"$fwsz2","fwsz3"=>"$fwsz3","money"=>"$tz[money]","size"=>"$tz[size]");
      }
     $pdid='10';
	}else if($act == 'fjok'){
		 $name=$_POST[name];
     $db->update('forum_data',array('name' => $name,'money' => $_POST[money]),"`fid` ='$fid' AND `id` ='$_POST[id]'");
     $pdid='30';
	}else if($act == 'fjsc'){
		 if( $_GET['id']){
		 	   $_GET[page]=$_GET['id'];
		 }
       $bbsssc=$db->get_one('forum_data'," `uid` ='$user_uid' AND `id` ='$_GET[page]'",'');
       $ltfjurl='data/forum/'.$bbsssc[url].'';
    	 @unlink($ltfjurl);
			 $db->delete('forum_data'," `uid` ='$user_uid' AND `id` ='$bbsssc[id]'");
     $pdid='30';
	}else if($act == 'sc'){
      $pdid='20';
	}else if($act == 'scok'){
        if($db->get_one('forum'," `id` ='$fid' AND `uid` ='$user_uid'",'')){
	         $sql=$db->query('forum_data'," `fid` ='$fid'ORDER BY `id` ","");
	         while($row=mysql_fetch_array($sql)){
	         	     @unlink(Bingz_upload_images('data/forum/'.$row[url].''));
                 @unlink("data/forum/".$row[url]."");
   	             $db->delete('forum_data'," `id` = '$row[id]'");
		             $db->delete('forum_data_user'," `fid` = '$row[id]'");
           }
   	       $db->delete('forum_polloption'," `tid` = '$fid'");
   	       $db->delete('forum_polloption_user'," `tid` = '$fid'");
   	       $db->delete('forum_hui'," `fid` = '$fid'");
   	       $db->delete('forum'," `id` = '$fid'");
        }
      $pdid='21';
	}else if($act == 'xgok'){
		    if($_POST[name] && $_POST[content]){
           $db->update('forum',array('name' => $_POST[name],'content' => $_POST[content],'type_lx' => $_POST[type_lx],'sz_lm' => $_POST[sz_lm],'sz_tz' => $_POST[sz_tz])," `id` ='$fid'");
           Bingz_cache_html_delete('forum','forum_'.$fid.'');
        }
        $pdid='30';
	}else{
     if($forum[type_lx] == '1'){$type_lxa='CHECKED';}elseif($forum[type_lx] == '2'){$type_lxb='CHECKED';}else{$type_lx='CHECKED';}
     if($forum[sz_lm] == '1'){$sz_lm='CHECKED';}else{$sz_lma='CHECKED';}
     if($forum[sz_tz] == '1'){$sz_tz='CHECKED';}else{$sz_tza='CHECKED';}
     $forum_name     =Bingz_html($forum[name]);
     $forum_content  =Bingz_html($forum[content]);
     $ltflsz =$forumlt[sz_fl];
     $yffll=$db->get_one('forum_tzfl'," `fid` ='$forum[cid]' AND `id` ='$forum[fid]'",'');
     $yflid=$forum[fid];
     $yflname=$yffll[name];
     $tzfl=$db->query('forum_tzfl'," `fid` ='$forum[cid]' ORDER BY `px` ",'');
     while($fl=mysql_fetch_array($tzfl)){
           $ltfl[]= array("fid"=>"$fid","id"=>"$fl[id]","name"=>"$fl[name]");
     }
  }
@include template('head');
@include template('forum/forum_admingolz');
@include template('foot');
?>